<?php

namespace App\Http\Controllers\api;

use App\Models\Order;
use App\Http\Controllers\Controller;
use App\Services\Redis;
use Illuminate\Http\Request;

class CurriculumController extends Controller
{
    /**
     * 订单列表
     */
    public function orderList(Request $request){

        //redis取出订单数据
        $redisRest=json_decode(Redis::getString('order'),true);

        //判断数据是否为空
        if(empty($redisRest)) {

            //查询订单数据
            $cartInfo = json_encode(Order::get());
            //将数据存入到redis
            $redisRest = Redis::setString('order',$cartInfo);

        }
        return  ['code'=>200,'msg'=>'查询成功','data'=>$redisRest];

    }
}
